certusApp.factory('authInterceptor', function ($rootScope, $cookies) {
    return {
        request: function (config) {
            config.headers = config.headers || {};
            if ("POST" == config.method) {
                if ($cookies.get('access_token')) {
                    config.headers.Authorization = $cookies.get("token_type") + " " + $cookies.get('access_token');
                    config.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
                }
            }
            return config;
        },
        responseError: function (response) {
            // ...
        }
    };
});
